﻿using System;
using System.Windows.Media;
using System.Xml.Serialization;

namespace Poet.Modules
{
    [Serializable]
    [XmlInclude(typeof(Pen))]
    [XmlInclude(typeof(SolidColorBrush))]
    [XmlInclude(typeof(MatrixTransform))]
    public class PaletteSet : Set
    {
        public Brush LineNumberForeground { get; set; } 
        public Brush LineNumberSeparator { get; set; } 
        public Brush SelectionBrush { get; set; } 
        public Brush Foreground { get; set; }  
        public Brush Background { get; set; }
        public Brush AccentuateBackground { get; set; }   
        public Brush CurrentLineBackground { get; set; }   
        public Brush SelectedText { get; set; }    
        public Pen SelectionBorder { get; set; }
        public Pen AccentuateBorder { get; set; }
        public Pen CurrentLineBorder { get; set; }

        public double AccentuateBorderCornerRadius { get; set; }
        public double CurrentLineBorderCornerRadius { get; set; }
        public double SelectionBorderCornerRadius { get; set; }

        public void Freeze()
        {
            if (SelectedText != null) SelectedText.Freeze();
            if (SelectionBorder != null) SelectionBorder.Freeze();
            if (Background != null) Background.Freeze();
            if (Foreground != null) Foreground.Freeze();
            if (SelectionBrush != null) SelectionBrush.Freeze();
            if (CurrentLineBackground != null) CurrentLineBackground.Freeze();
            if (CurrentLineBorder != null) CurrentLineBorder.Freeze();
            if (AccentuateBorder != null) AccentuateBorder.Freeze();
            if (AccentuateBackground != null) AccentuateBackground.Freeze();
            if (LineNumberSeparator != null) LineNumberSeparator.Freeze();
            if (LineNumberForeground != null) LineNumberForeground.Freeze();
        }
    }
}
